package com.fatloss.angel;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class two_adapter extends BaseAdapter {
	
	Context m_context;
	LayoutInflater inflater;
	List<three> recs;


	public two_adapter(Context m_context) {
		super();
		this.m_context = m_context;
		this.inflater = LayoutInflater.from(m_context);
		this.recs = new ArrayList<three>();
	}

	public void add(String food, String time, int cal, int id)
	{
		three tmp3 = new three(food, time, cal, id);
		recs.add(tmp3);
	}
	
	public void removeAll()
	{
		recs.removeAll(recs);
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return recs.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = inflater.inflate(R.layout.list_item2, null);

		TextView tv1 = (TextView)view.findViewById(R.id.listv1);
		TextView tv2 = (TextView)view.findViewById(R.id.listv2);
		
		tv1.setText(recs.get(position).time);
		tv2.setText(String.valueOf(recs.get(position).calo));
		
		return view;
	}

}
